package com.itheima.blog.auth.controller;

import com.itheima.blog.auth.dto.LoginReqDto;
import com.itheima.blog.auth.dto.LoginResDTO;
import com.itheima.blog.auth.dto.UserDto;
import com.itheima.blog.auth.service.LoginService;
import com.itheima.common.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
public class LoginController {

    @Autowired
    private LoginService loginService;

    @PostMapping("/login/in")
    public R<LoginResDTO> login(@Valid @RequestBody LoginReqDto dto){
        LoginResDTO result = loginService.login(dto);
        return R.ok(result);
    }

}
